package com.example.question.dp.dp3;

public class Code01_62 {
    public static void main(String[] args) {
        Code01_62 code = new Code01_62();
        int i = code.uniquePaths(3, 2);
        System.out.println(i);
    }

    public int uniquePaths(int m, int n) {
        int[][] dp = new int[m][n];
        dp[0][0] = 1;
        for (int row = 1; row < m; row++) {
            dp[row][0] = 1;
        }
        for (int col = 1; col < n; col++) {
            dp[0][col] =  1;
        }
        for (int row = 1; row < m; row++) {
            for (int col = 1; col < n; col++) {
                dp[row][col] = dp[row - 1][col] + dp[row][col - 1];
            }
        }
        return dp[m - 1][n - 1];
    }
}
